<?php

namespace App\Providers;

use Illuminate\Support\ServiceProvider;
use View;

class AppServiceProvider extends ServiceProvider
{
    /**
     * Bootstrap any application services.
     *
     * @return void
     */
    public function boot()
    {
        //这是全局变量 整个laravel可以使用
        $nav = '呵呵哒 ';
        view::share(['nav'=>$nav]);

        //指定页面变量
        view::composer('*', function($view){
            $view->with('user','kent');
        });
    }

    /**
     * Register any application services.
     *
     * @return void
     */
    public function register()
    {
        //
    }
}
